home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- //
- // Creation Date: 2001
- // Author: dbrins
- //
- //<doc>
- //<name attrPresetEditWin>
- //<owner "Alias|Wavefront Unsupported">
- //
- //<synopsis>
- // attrPresetEditWin nodeType
- //
- //<returns>
- // None.
- //
- //<description>
- // Opens the attribute preset editor window. This allows
- // one to delete presets for a given node type.
- // The initial node type to display must be specified.
- //
- //<examples>
- // attrPresetEditWin "transform"
- // attrPresetEditWin "brush"
- //</doc>
-
-
-
- global string $gApeWinPresetList = "";
- global string $gApeWinNodeType = "";
-
- global proc deleteSelectedAttrPresets(){
- global string $gApeWinPresetList;
- global string $gApeWinNodeType;
-
- if( "" == $gApeWinPresetList ){
- return;
- }
- if( "" == $gApeWinNodeType ){
- return;
- }
-
- string $nodeType = $gApeWinNodeType;
- string $ppath = `internalVar -userPrefDir`;
- $ppath = substitute( "prefs", $ppath, "presets/attrPresets");
- $ppath = $ppath + $nodeType;
-
- string $selectedPresets[] = `textScrollList -q -si $gApeWinPresetList`;
- string $preset;
- for( $preset in $selectedPresets ){
- sysFile -delete ($ppath + "/" + $preset + ".mel" );
- }
- if( size($selectedPresets) > 0 ){
- updateAPEWinNodetype( $nodeType );
- }
- }
-
- //
- // reset the nodetype being displayed by the attrPresetEditWin
- //
- global proc updateAPEWinNodetype( string $nodeType ){
- global string $gApeWinPresetList;
- global string $gApeWinNodeType;
-
- if( !`window -exists attrPresetEditWin` ) {
- return;
- }
- if( "" == $gApeWinPresetList ){
- return;
- }
- $gApeWinNodeType = $nodeType;
- string $windowTitle = "Edit " + $nodeType + " Presets";
- window -e -t $windowTitle attrPresetEditWin;
-
- string $ppath = `internalVar -userPrefDir`;
- $ppath = substitute( "prefs", $ppath, "presets/attrPresets");
- $ppath = $ppath + $nodeType;
- textScrollList -e -ra $gApeWinPresetList;
- if( `file -q -ex $ppath` ){
- string $files;
- if( `about -nt` ){
- $files = `system ( "dir /b \"" + $ppath +"\"")`;
- } else if (`about -irix` || `about -linux` || `about -mac`) {
- $files = `system ( "ls " + $ppath )`;
- } else {
- warning( "Operating system unrecognized." );
- }
-
- string $fileList[];
- int $numTokens = tokenize( $files, $fileList );
- // create Directory for current node type
- if ($numTokens > 0 && !($numTokens == 1 && $fileList[0] == "unknown")) {
- string $file;
- for ( $file in $fileList ) {
- // only show .mel files
- if( size( match( ".mel", $file ) ) ){
- string $presetName = `substitute ".mel" $file ""`;
- textScrollList -e -append $presetName $gApeWinPresetList;
- }
- }
- }
- }
-
- }
-
- //
- // Open the attribute Preset Editor
- //
- global proc attrPresetEditWin( string $nodeType )
- {
- global string $gApeWinPresetList;
- global string $gApeWinNodeType;
- if( !`window -exists attrPresetEditWin` )
- {
- string $windowTitle = "Edit " + $nodeType + " Presets";
- window -t $windowTitle -iconName "Edit Presets" -w 410 -h 150 attrPresetEditWin;
- formLayout fl;
-
- setParent -m ..;
-
- $gApeWinPresetList = `textScrollList -allowMultiSelection true psetList`;
- separator -horizontal true shelfSeparator;
- button
- -annotation "delete selected presets"
- -l "Delete"
- -c "deleteSelectedAttrPresets()"
- deleteAttrPresetButton;
- button
- -label "Close"
- -c "window -e -visible false attrPresetEditWin"
- closeAttrPresetEdButton;
-
-
- formLayout -e
- -af shelfSeparator "left" 0
- -af shelfSeparator "right" 0
- -ac shelfSeparator "bottom" 5 closeAttrPresetEdButton
-
- -af psetList "top" 5
- -af psetList "left" 5
- -af psetList "right" 5
- -ac psetList "bottom" 5 shelfSeparator
-
- -af deleteAttrPresetButton "left" 5
- -af deleteAttrPresetButton "bottom" 5
- -ap deleteAttrPresetButton "right" 3 50
- -an deleteAttrPresetButton "top"
-
- -ap closeAttrPresetEdButton "left" 2 50
- -af closeAttrPresetEdButton "bottom" 5
- -af closeAttrPresetEdButton "right" 5
- -an closeAttrPresetEdButton "top"
- fl;
- }
- updateAPEWinNodetype( $nodeType );
- showWindow attrPresetEditWin;
- }
-